<!DOCTYPE html>
<html>
#{include file="header.html"}#
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="row">
    <div class="col-sm-12">
      <div class="ibox float-e-margins">
        <div class="ibox-title">
          <h5><i class="fa fa-home"></i> 权限菜单</h5>
        </div>
        <div class="ibox-content">
			<form id="pagerForm" method="post" class="form-inline">
			  <input type="hidden" name="role_id" value="#{$role_id}#">
          <div class="treeClassBody">#{$treeHtml}#</div>
				<div class="ibox-content"><button type="button" class="btn btn-info save-data">确认选择</button></div>
			</form>
        </div>
      </div>
    </div>
  </div>
</div>
</body>
</html>
<script src="#{$smarty.const.APP}#/View/template/js/content.js?v=1.0.0"></script>
<script type="text/javascript">
$(document).ready(function () {
	$('.i-checks').iCheck({
		checkboxClass: 'icheckbox_square-green',
		radioClass: 'iradio_square-green',
	});
	$("body").on("click", ".children_method", function() {//最后一栏目选择
		$(this).nextAll().prop("checked", $(this).prop('checked'));
		$(this).parents('.children_menu').prop("checked", $(this).prop('checked'));
		$(this).parents('.userlist_method').prop("checked", $(this).prop('checked'));
	});
	$("body").on("click", ".children_menu", function() {//最后一栏目选择
		chk= $(this).prop('checked');
		$(this).parent().parent().parent().find('input').prop("checked", $(this).prop('checked'));
		$(this).parents('.children_menu').prop("checked", $(this).prop('checked'));
	});
	
	////获取窗口索引关闭窗口
	var list_add_index = parent.layer.getFrameIndex(window.name); 
	
	//保存数据
	$("body").on("click", ".save-data", function() {
		var users=[];
		var title=[];
		$("input:checkbox[name='sys_user_id[]']:checked").each(function() { // 遍历name=test的多选框
			title.push($(this).attr('title'));
			users.push($(this).val());
		});
		users=users.join(",");
		title=title.join(",");
		alert(title);
	
		layer.msg('操作成功', {icon: 1}); 	
		setTimeout(function(){
			parent.layer.close(list_add_index);
		 },800);	
	});
	

	
});
</script>